<?php

declare(strict_types=1);
/**
 * This file is part of MineAdmin.
 *
 * @link     https://www.mineadmin.com
 * @document https://doc.mineadmin.com
 * @contact  root@imoi.cn
 * @license  https://github.com/mineadmin/MineAdmin/blob/master/LICENSE
 */

namespace App\Http\Admin\Request\Question;

use App\Schema\Question\QuestionGroupSchema;
use Hyperf\Validation\Request\FormRequest;
use Mine\Swagger\Attributes\FormRequest as FormRequestAnnotation;

#[FormRequestAnnotation(
    schema: QuestionGroupSchema::class,
    title: '创建题库分组',
    required: [
        'name',
        'description'
    ],
    only: [
        'name',
        'description'
    ]
)]
class QuestionGroupRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'name' => 'required|string',
            'description' => 'required|string',
        ];
    }

    public function attributes(): array
    {
        return [
            'name' => trans('question-group-group.name'),
            'description' => trans('question-group-group.description'),
        ];
    }
}
